package com.itheima.myhashset;

import java.util.HashSet;
import java.util.Iterator;

public class HashSetDemo1 {
    public static void main(String[] args) {
        HashSet<String> hs = new HashSet<>();
        hs.add("cc");
        hs.add("bb");
        hs.add("cc");
        hs.add("bb");
        hs.add("aa");
        hs.add("cc");

        Iterator<String> it = hs.iterator();
        while (it.hasNext()){
            String s = it.next();
            System.out.println(s);
        }

        System.out.println("------------------");

        for (String h : hs) {
            System.out.println(h);
        }
    }
}
